// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "GameplayTagContainer.h"
#include "DataAsset/CharacterClassInfo.h"
#include "UObject/Interface.h"
#include "CombatInterface.generated.h"

class UNiagaraSystem;
/** 蒙太奇动画和事件标签以及骨骼位置的映射 */
/** 在这里定义是因为接口要用这个类型,接口用优先在接口定义 */
USTRUCT(BlueprintType)
struct FTaggedMontage
{
	GENERATED_BODY()

	/** 使用的蒙太奇 */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TObjectPtr<UAnimMontage> Montage;

	/** 当前蒙太奇标签 */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	FGameplayTag MontageTag;

	/** 蒙太奇中攻击通知的事件标签 */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	FGameplayTag SocketTag;

	/** 技能释放位置的骨骼插槽 */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	FName CombatTipSocketName;

	/** 攻击命中时触发的音效 */
	UPROPERTY(EditDefaultsOnly, BlueprintReadOnly)
	TObjectPtr<USoundBase> ImpactSound;
};


// This class does not need to be modified.
UINTERFACE(MinimalAPI, BlueprintType)
class UCombatInterface : public UInterface
{
	GENERATED_BODY()
};

/**
 * 战斗通用接口
 */
class AURA_API ICombatInterface
{
	GENERATED_BODY()

	// Add interface functions to this class. This is the class that will be inherited to implement this interface.
public:

	/** 获取等级 */
	virtual int32 GetLevel() = 0;

	/** 获取角色职业 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	ERoleClass GetRoleClass() const;

	/** 获取仆从数量 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	int32 GetMinionsCount() ;
	
	/** 角色仆从的增长数量，负数为负增长 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	void IncrementMinionsCount(const int32 Amount);
	
	/** 获取骨骼插槽的位置 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	FVector GetCombatSocketLocation() const;

	/** 更新朝向 */
	UFUNCTION(BlueprintImplementableEvent, BlueprintCallable)
	void UpdateFacing(const FVector& Target);

	/** 获取受击蒙太奇动画 */
	UFUNCTION(blueprintNativeEvent, BlueprintCallable)
	UAnimMontage* GetHitReactMontage() const;

	/** 死亡 */
	virtual void Die() = 0;

	/** 检查当前角色是否死亡 */
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	bool IsDead() const;

	/** 获取当前角色 */
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	AActor* GetAvatar();

	/** 获取攻击蒙太奇 */
	UFUNCTION(BlueprintCallable, BlueprintNativeEvent)
	TArray<FTaggedMontage> GetAttackMontages() const;

	/** 根据蒙太奇封装结构体获取攻击骨骼插槽的位置 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	FVector GetCombatSocketLocationByStruct(const FTaggedMontage& TaggedMontage) const;

	/** 根据蒙太奇标签获取蒙太奇封装结构体 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	FTaggedMontage GetTaggedMontageByTag(const FGameplayTag& MontageTag) const;

	/** 获取角色受伤特效 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	UNiagaraSystem* GetBloodEffect() const;

	/** 通过标签获取战斗插槽位置 */
	UFUNCTION(BlueprintNativeEvent, BlueprintCallable)
	FVector GetCombatSocketLocationByTag(const FGameplayTag SocketTag, const FName& SocketName) const;
};
